﻿// Fill out your copyright notice in the Description page of Project Settings.

#include "SaveLocationBox.h"
#include "Engine.h"
#include "BSiteLearnGameModeBase.h"
#include "Components/StaticMeshComponent.h"


ASaveLocationBox::ASaveLocationBox()
{
	SaveMeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("SaveMesh"));
	SaveMeshComp->SetupAttachment(HitBoxComp);
}

void ASaveLocationBox::OnHitSphere(ASphereBase* sphere)
{
	ABSiteLearnGameModeBase* mode = Cast<ABSiteLearnGameModeBase>(GetWorld()->GetAuthGameMode());
	
	mode->SetCurrentPlayerPos(HitBoxComp->GetComponentLocation());
}
